home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q1082.dms / q1082.adf / src.lzh / Fig / object.h < prev    next >
Text File  |  1991-07-18  |  5KB  |  213 lines

  1. /* 
  2.  *    FIG : Facility for Interactive Generation of figures
  3.  *
  4.  *    (c) copy right 1985 by Supoj Sutanthavibul (supoj@sally.utexas.edu)
  5.  *      January 1985.
  6.  *    1st revision : Aug 1985.
  7.  *    2nd revision : Feb 1988.
  8.  *
  9.  *    %W%    %G%
  10. */
  11. typedef        struct f_pattern {
  12.             int            w, h;
  13.             int            *p;
  14.             }
  15.         F_pattern;
  16.  
  17. typedef        struct f_pen {
  18.             int            x, y;
  19.             int            *p;
  20.             }
  21.         F_pen;
  22.  
  23. typedef        struct f_point {
  24.             int            x, y;
  25.             struct f_point        *next;
  26.             }
  27.         F_point;
  28.  
  29. typedef        struct f_pos {
  30.             int            x, y;
  31.             }
  32.         F_pos;
  33.  
  34. typedef        struct f_arrow {
  35.             int            type;
  36.             int            style;
  37.             float            thickness;
  38.             float            wid;
  39.             float            ht;
  40.             }
  41.         F_arrow;
  42.  
  43. typedef        struct f_ellipse {
  44.             int            type;
  45. #define                    T_ELLIPSE_BY_RAD    1
  46. #define                    T_ELLIPSE_BY_DIA    2
  47. #define                    T_CIRCLE_BY_RAD        3
  48. #define                    T_CIRCLE_BY_DIA        4
  49.             int            style;
  50.             int            thickness;
  51.             int            color;
  52. #define                    BLACK            0
  53.             int            depth;
  54.             int            direction;
  55.             float            style_val;
  56.             float            angle;
  57.             struct f_pen        *pen;
  58.             struct f_pattern    *area_fill;
  59.             struct f_pos        center;
  60.             struct f_pos        radiuses;
  61.             struct f_pos        start;
  62.             struct f_pos        end;
  63.             struct f_ellipse    *next;
  64.             }
  65.         F_ellipse;
  66.  
  67. typedef        struct f_arc {
  68.             int            type;
  69. #define                    T_3_POINTS_ARC        1
  70.             int            style;
  71.             int            thickness;
  72.             int            color;
  73.             int            depth;
  74.             struct f_pen        *pen;
  75.             struct f_pattern    *area_fill;
  76.             float            style_val;
  77.             int            direction;
  78.             struct f_arrow        *for_arrow;
  79.             struct f_arrow        *back_arrow;
  80.             struct {float x, y;}    center;
  81.             struct f_pos        point[3];
  82.             struct f_arc        *next;
  83.             }
  84.         F_arc;
  85.  
  86. typedef        struct f_line {
  87.             int            type;
  88. #define                    T_POLYLINE    1
  89. #define                    T_BOX        2
  90. #define                    T_POLYGON    3
  91.             int            style;
  92.             int            thickness;
  93.             int            color;
  94.             int            depth;
  95.             float            style_val;
  96.             struct f_pen        *pen;
  97.             struct f_pattern    *area_fill;
  98.             struct f_arrow        *for_arrow;
  99.             struct f_arrow        *back_arrow;
  100.             struct f_point        *points;
  101.             struct f_line        *next;
  102.             }
  103.         F_line;
  104.  
  105. typedef        struct f_text {
  106.             int            type;
  107. #define                    T_LEFT_JUSTIFIED    0
  108. #define                    T_CENTER_JUSTIFIED    1
  109. #define                    T_RIGHT_JUSTIFIED    2
  110.             int            font;
  111.             int            size;    /* point size */
  112.             int            color;
  113.             int            depth;
  114.             float            angle;    /* in radian */
  115.  
  116.             int            style;
  117. #define                    PLAIN        1
  118. #define                    ITALIC        2
  119. #define                    BOLD        4
  120. #define                    OUTLINE        8
  121. #define                    SHADOW        16
  122.  
  123.             int            height;    /* pixels */
  124.             int            length;    /* pixels */
  125.             int            base_x;
  126.             int            base_y;
  127.             struct f_pen        *pen;
  128.             char            *cstring;
  129.             struct f_text        *next;
  130.             }
  131.         F_text;
  132.  
  133. typedef        struct f_control {
  134.             float            lx, ly, rx, ry;
  135.             struct f_control    *next;
  136.             }
  137.         F_control;
  138.  
  139. #define        int_spline(s)        (s->type & 0x2)
  140. #define        normal_spline(s)    (!(s->type & 0x2))
  141. #define        closed_spline(s)    (s->type & 0x1)
  142. #define        open_spline(s)        (!(s->type & 0x1))
  143.  
  144. typedef        struct f_spline {
  145.             int            type;
  146. #define                    T_OPEN_NORMAL        0
  147. #define                    T_CLOSED_NORMAL        1
  148. #define                    T_OPEN_INTERPOLATED    2
  149. #define                    T_CLOSED_INTERPOLATED    3
  150.             int            style;
  151.             int            thickness;
  152.             int            color;
  153.             int            depth;
  154.             float            style_val;
  155.             struct f_pen        *pen;
  156.             struct f_pattern    *area_fill;
  157.             struct f_arrow        *for_arrow;
  158.             struct f_arrow        *back_arrow;
  159.             /*
  160.             For T_OPEN_NORMAL and T_CLOSED_NORMAL points
  161.             are control points while they are knots for
  162.             T_OPEN_INTERPOLATED and T_CLOSED_INTERPOLTED
  163.             whose control points are stored in controls.
  164.             */
  165.             struct f_point        *points;
  166.             struct f_control    *controls;
  167.             struct f_spline        *next;
  168.             }
  169.         F_spline;
  170.  
  171. typedef        struct f_compound {
  172.             struct f_pos        nwcorner;
  173.             struct f_pos        secorner;
  174.             struct f_line        *lines;
  175.             struct f_ellipse    *ellipses;
  176.             struct f_spline        *splines;
  177.             struct f_text        *texts;
  178.             struct f_arc        *arcs;
  179.             struct f_compound    *compounds;
  180.             struct f_compound    *next;
  181.             }
  182.         F_compound;
  183.  
  184. #define        ARROW_SIZE        sizeof(struct f_arrow)
  185. #define        POINT_SIZE        sizeof(struct f_point)
  186. #define        CONTROL_SIZE        sizeof(struct f_control)
  187. #define        ELLOBJ_SIZE        sizeof(struct f_ellipse)
  188. #define        ARCOBJ_SIZE        sizeof(struct f_arc)
  189. #define        LINOBJ_SIZE        sizeof(struct f_line)
  190. #define        TEXOBJ_SIZE        sizeof(struct f_text)
  191. #define        SPLOBJ_SIZE        sizeof(struct f_spline)
  192. #define        COMOBJ_SIZE        sizeof(struct f_compound)
  193.  
  194. /**********************  object codes  **********************/
  195.  
  196. #define        O_ELLIPSE        1
  197. #define        O_POLYLINE        2
  198. #define        O_SPLINE        3
  199. #define        O_TEXT            4
  200. #define        O_ARC            5
  201. #define        O_COMPOUND        6
  202. #define        O_END_COMPOUND        -O_COMPOUND
  203. #define        O_ALL_OBJECT        99
  204.  
  205. /************  object styles (except for f_text)  ************/
  206.  
  207. #define        SOLID_LINE        0
  208. #define        DASH_LINE        1
  209. #define        DOTTED_LINE        2
  210.  
  211. #define        CLOSED_PATH        0
  212. #define        OPEN_PATH        1
  213.